﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="admin_title.aspx.cs" Inherits="skvote.admin_title" %>

<%@ Import Namespace="System.Data.OleDb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<%skvote.function.header(Response);%>
<title>【单考投票系统】后台管理中心</title>
</head>
<script language="JavaScript" type="text/javascript">
function XH() {
	for (var i=0;i<document.XHH.XHID.length;i++) {
		var e=document.XHH.XHID[i];
		e.checked=!e.checked;
	}
}	
</script>
<body>
<table border="0" cellpadding="1" cellspacing="2" width="100%" id="table1" bgcolor="#E1F0FF">
  <form id="form1" runat="server">
  <tr>
    <td>
	   <table width="100%" id="table2" cellspacing="1">
	     <tr>
          <td id="TableTitle1"> 管理投票问题-&gt;
          <%
              if (!string.IsNullOrEmpty(Request["sid"]) && !string.IsNullOrEmpty(Request["k"]))
              {
                  Response.Write("主题(");
                  OleDbConnection connection = new skvote.conn().CreateConnection();
                  try
                  {
                      connection.Close();
                      connection.Open();
                      OleDbCommand cmd = new OleDbCommand("select subject from xh_subject where id=" + Request["sid"].Trim(), connection);
                      OleDbDataReader dr = cmd.ExecuteReader();
                      if (dr.HasRows)
                      {
                          dr.Read();
                          Response.Write(dr["subject"].ToString() + ")");
                      }
                      else
                      {
                          Response.Write("不存在这样的主题)");
                      }
                      Response.Write("&nbsp;投票问题->搜索结果(" + skvote.function.nohtml(Request["k"])+")");
                      dr.Close();
                      cmd.Dispose();
                  }
                  finally
                  {
                      connection.Close();
                  }                  
              }
              else if(string.IsNullOrEmpty(Request["sid"]) && !string.IsNullOrEmpty(Request["k"]))
              {
                  Response.Write("&nbsp;投票问题->搜索结果(" + skvote.function.nohtml(Request["k"]) + ")");
              }
              else if (string.IsNullOrEmpty(Request["k"]) && !string.IsNullOrEmpty(Request["sid"]))
              {
                  Response.Write("主题(");
                  OleDbConnection connection = new skvote.conn().CreateConnection();
                  try
                  {
                      connection.Close();
                      connection.Open();
                      OleDbCommand cmd = new OleDbCommand("select * from xh_subject where id=" + Request["sid"].Trim(), connection);
                      OleDbDataReader dr = cmd.ExecuteReader();
                      if (dr.HasRows)
                      {
                          dr.Read();
                          Response.Write(dr["subject"].ToString() + ")");
                      }
                      else
                      {
                          Response.Write("不存在这样的主题)");
                      }
                      Response.Write("&nbsp;投票问题->所有投票问题");
                      dr.Close();
                      cmd.Dispose();
                  }
                  finally
                  {
                      connection.Close();
                  }
              }
              else
              {
                  Response.Write("所有投票问题");
              }
          %>      
      	  </td>
		 </tr>
	   </table>
	   </td>
  </tr>
  <tr>
    <td>
      
      <asp:DataGrid ID="table2" runat="server" AllowPaging="true" 
            HeaderStyle-CssClass="DataGrid1_Header_Footer" 
            FooterStyle-CssClass="DataGrid1_Header_Footer" AutoGenerateColumns="false" 
            Width="100%" onitemcreated="table2_ItemCreated"  PageSize="20"
            onpageindexchanged="table2_PageIndexChanged" ShowFooter="True" BorderColor="#BFDFFF" BorderWidth="1px">
<FooterStyle CssClass="DataGrid1_Header_Footer"></FooterStyle>
          <PagerStyle Mode="NumericPages" Visible="false" />
       <Columns>
        <asp:TemplateColumn>
         <HeaderTemplate>
          ID
         </HeaderTemplate>
         <FooterTemplate>
          ID
         </FooterTemplate>
         <ItemStyle Width="5%" HorizontalAlign="Center" />
         <ItemTemplate>
          <%#DataBinder.Eval(Container.DataItem,"Id") %>
         </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn>
         <HeaderStyle Width="5%" HorizontalAlign="Center" />
         <HeaderTemplate>
          <asp:CheckBox ID="headerchk" runat="server" AutoPostBack="true" />
         </HeaderTemplate>
         <FooterStyle Width="5%" HorizontalAlign="Center" />
         <FooterTemplate>
          <asp:CheckBox ID="footerchk" runat="server" AutoPostBack="true" />
         </FooterTemplate>
         <ItemStyle Width="5%" HorizontalAlign="Center" />
         <ItemTemplate>
          <asp:CheckBox ID="choosechk" runat="server" Text="" ToolTip='<%#DataBinder.Eval(Container.DataItem,"Id")%>' />         
         </ItemTemplate>         
        </asp:TemplateColumn>        
        <asp:TemplateColumn>
         <HeaderTemplate>
         投票问题名称
         </HeaderTemplate>
         <FooterTemplate>
         投票问题名称
         </FooterTemplate>
         <ItemStyle HorizontalAlign="Center" />
         <ItemTemplate>
          <a href='admin_title_modify.aspx?id=<%#DataBinder.Eval(Container.DataItem,"Id")%>&sid=<%#DataBinder.Eval(Container.DataItem,"sid")%>'><%#DataBinder.Eval(Container.DataItem,"title") %></a>
         </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn>
         <HeaderTemplate>
          所属主题名称
         </HeaderTemplate>
         <FooterTemplate>
          所属主题名称
         </FooterTemplate>
         <ItemStyle HorizontalAlign="Center" Width="20%" />
         <ItemTemplate>
         <%#GetSubject(Eval("sid").ToString())%>
         </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn>
         <HeaderTemplate>
          投票类别
         </HeaderTemplate>
         <FooterTemplate>
          投票类别
         </FooterTemplate>
         <ItemStyle Width="20%" HorizontalAlign="Center" />          
         <ItemTemplate>
          <%#GetMs(Eval("ms").ToString())%>
         </ItemTemplate>         
        </asp:TemplateColumn>
        <asp:TemplateColumn>
         <HeaderTemplate>
          单项操作
         </HeaderTemplate>
         <FooterTemplate>
          单项操作
         </FooterTemplate>
         <ItemStyle Width="10%" HorizontalAlign="Center" />
         <ItemTemplate>
          <a href="admin_title.aspx?id=<%#Eval("id").ToString()%>&act=del">删除</a>
         </ItemTemplate>
        </asp:TemplateColumn>
       </Columns>       

<HeaderStyle CssClass="DataGrid1_Header_Footer"></HeaderStyle>
      </asp:DataGrid>      
    </td>
  </tr>
  <tr>
   <td><asp:Button ID="delete" runat="server" Text="删除所选投票标题" CssClass="btn" 
           onclick="delete_Click" />&nbsp;<input type="text" name="k" id="k" />&nbsp;<asp:Button 
           ID="search" runat="server" Text="搜索投票标题" CssClass="btn" 
           onclick="search_Click" /></td>
  </tr>
  <tr>
   <td>总共&nbsp;<asp:Label ID="recordlbl" runat="server"></asp:Label>&nbsp;条记录
   &nbsp;共&nbsp;<asp:Label ID="pageslbl" runat="server"></asp:Label>&nbsp;页&nbsp;
   第&nbsp;<asp:Label ID="pagelbl" runat="server"></asp:Label>&nbsp;页&nbsp;
   <asp:LinkButton ID="first" Text="首页" runat="server" CommandArgument="FIRST" 
           onclick="first_Click"></asp:LinkButton>&nbsp;   
   <asp:LinkButton ID="prev" Text="上一页" runat="server" CommandArgument="PREV" 
           onclick="first_Click"></asp:LinkButton>&nbsp;
   <asp:LinkButton ID="next" Text="下一页" runat="server" CommandArgument="NEXT" 
           onclick="first_Click"></asp:LinkButton>&nbsp;
   <asp:LinkButton ID="last" Text="末页" runat="server" CommandArgument="LAST" 
           onclick="first_Click"></asp:LinkButton>
   </td>
  </tr>
  </form>
</table>
</body>
</html>
